home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Die Speccy' 97
/
Die Speccy' 97.iso
/
amiga_system
/
the_aminet
/
dev
/
asm
/
basmify.lha
/
Basmify
/
NextError.ced
< prev
Wrap
Text File
|
1995-09-26
|
8KB
|
321 lines
/* Show errors produced by Assemble.ced.
**
** This ARexx script show the next of the errors in the
** error list of BAsm, after a Assemble.ced run.
** CygnusEd is used to display the errors.
**
** Written and copyright in 1995 by Ulrich Flegel.
** All rights are reserved to the author Ulrich Flegel.
**
** Publication and distribution only allowed by explicitly written permission from the author.
** This software may be distribute on the Aminet CD-ROMs.
**
** system requirements:
** Assemble.ced (V1.0 or higher)
** CygnusEd (V3.5 or higher)
** BAsm (V1.123 or higher)
** SetEnv (AmigaOS release)
** rx (ARexx release)
**
** current version of this script:
**
** $VER: NextError.ced V1.0 (15-Sep-95)
**
** usage:
** call as ARexx Macro from CygnusEd as: NextError.ced
**
*/
/*============================================================================*/
OPTIONS RESULTS /* enable return codes */
/*============================================================================*/
/* parameters used to control this program */
/* NextError.ced Port_CygnusEd */
PARSE ARG Port_CygnusEd
/*============================================================================*/
/* adapt the following variables to your system environment: */
Assemble = 'BAsmify:Assemble.ced' /* here substitute the complete path/name of the Assemble.ced script */
MaxViews = 20 /* here substitue the maximum number of views CygnusEd is able to open */
/*============================================================================*/
/* Only Assemble.ced may supply the parameter Port_CygnusEd above !! */
/* If parameter correct, it is assumed, that the first error is not to be skipped */
IF (LEFT(Port_CygnusEd, 8) = 'rexx_ced') THEN
InvokedByAssembleScript = TRUE
ELSE
InvokedByAssembleScript = FALSE
/*============================================================================*/
BAsmError_Max = 200
BAsmError_OK = 0
BAsmError_False = 20
BAsmError_OpenError = 1
BAsmError_SourceError = 2
BAsmError_ReadError = 3
BAsmError_UnknownOption = 4
BAsmError_MemoryError = 5
BAsmError_NoSourceFile = 6
BAsmError_NoNextError = 7
BAsmError_NoErrorList = 8
BAsmError_NoNextWarning = 9
BAsmError_NoWarningList = 10
/*============================================================================*/
/* ARexx ports used */
Port_BAsm='rexx_BASM'
IF (Port_CygnusEd='') THEN Port_CygnusEd=ADDRESS()
IF (LEFT(Port_CygnusEd, 8) ~= 'rexx_ced') THEN Port_CygnusEd='rexx_ced'
/*============================================================================*/
ScriptErrorLevel = 6
SIGNAL ON SYNTAX /* ensure clean exit */
IF ~ SHOW('P', Port_CygnusEd) THEN /* is CygnusEd AREXX port available ? */
DO
Say 'This script may only called by CygnusEd!'
END
ELSE
DO
OPTIONS FAILAT ScriptErrorLevel /* ignore warnings */
/*============================================================================*/
/*
** Non localized strings used
*/
STRING_ThisScript='NextError.ced'
/*
** Localization of strings used
*/
ADDRESS VALUE Port_CygnusEd
/*'QUERY CAT'*/ /* !!! here find out which language CED uses currently */
Language=RESULT
SELECT
WHEN Language='deutsch' THEN
DO
STRING_Positive='OK'
STRING_Negative='Abbrechen'
STRING_Dismiss='Aufgeben'
STRING_BAsmFailure_Title='BAsm Fehler-Report'
ERROR_NoBAsm='Der Source wurde noch nicht assembliert! Soll dies JETZT geschehen?'
ERROR_BASM_UnknownErrorCode='Ein unbekannter Fehler ist aufgetreten!'
ERROR_BASM_NoNextErrorWarning='Keine weiteren Fehler bzw. Warnungen vorhanden!'
ERROR_BASM_NoErrorWarningList='Keine Fehlerliste bzw. Warnungsliste vorhanden!'
END
/*
WHEN Language='XXX' THEN
DO
STRING_Positive='XXX'
STRING_Negative='XXX'
STRING_Dismiss='XXX'
STRING_BAsmFailure_Title='XXX'
ERROR_NoBAsm='XXX!'
ERROR_BASM_UnknownErrorCode='XXX!'
ERROR_BASM_NoNextErrorWarning='XXX!'
ERROR_BASM_NoErrorWarningList='XXX!'
END
*/
OTHERWISE
DO
STRING_Positive='OK'
STRING_Negative='Cancel'
STRING_Dismiss='Dismiss'
STRING_BAsmFailure_Title='BAsm error report'
ERROR_NoBAsm='The source is not yet assembled! Assemble NOW?'
ERROR_BASM_UnknownErrorCode='An unknown error occurred!'
ERROR_BASM_NoNextErrorWarning='No more errors/warnings!'
ERROR_BASM_NoErrorWarningList='No error/warnings list!'
END
END
/*============================================================================*/
/*
** Finally do something
*/
IF ~ SHOW('P', Port_BAsm) THEN /* is BAsm running ? */
DO
ADDRESS VALUE Port_CygnusEd
'OKAY2 '||ERROR_NoBAsm
IF (RESULT = 1) THEN ADDRESS COMMAND 'SYS:RexxC/rx '||Assemble
END
ELSE
DO
OPTIONS FAILAT BAsmError_NoWarningList+1
ADDRESS VALUE Port_BAsm
IF (InvokedByAssembleScript = TRUE) THEN /* do not step over first error/warning! */
DO
'BINITERROR'
IF (RC = BAsmError_NoErrorList) THEN
CALL RexxSetEnv( 'BAsmError.ced', 'end' )
ELSE
CALL RexxSetEnv( 'BAsmError.ced', 'init' )
'BINITWARNING'
IF (RC = BAsmError_NoWarningList) THEN
CALL RexxSetEnv( 'BAsmWarning.ced', 'end' )
ELSE
CALL RexxSetEnv( 'BAsmWarning.ced', 'init' )
END
ErrorState = RexxGetEnv( 'BAsmError.ced' )
WarningState = RexxGetEnv( 'BAsmWarning.ced' )
SELECT
WHEN (ErrorState = 'init') THEN CALL RexxSetEnv( 'BAsmError.ced', 'step' )
WHEN (ErrorState = 'step') THEN
DO
'BNEXTERROR'
IF (RC = BAsmError_NoNextError) THEN
DO
CALL RexxSetEnv( 'BAsmError.ced', 'end' )
IF (WarningState = 'init') THEN CALL RexxSetEnv( 'BAsmWarning.ced', 'step' )
END
END
WHEN (ErrorState = 'end') THEN
SELECT
WHEN (WarningState = 'init') THEN CALL RexxSetEnv( 'BAsmWarning.ced', 'step' )
WHEN (WarningState = 'step') THEN
DO
'BNEXTWARNING'
IF (RC = BAsmError_NoNextWarning) THEN
DO
CALL RexxSetEnv( 'BAsmWarning.ced', 'end' )
'BEND'
ADDRESS VALUE Port_CygnusEd
'OKAY1 '||ERROR_BASM_NoNextErrorWarning
END
END
WHEN (WarningState = 'end') THEN
DO
'BEND'
ADDRESS VALUE Port_CygnusEd
'OKAY1 '||ERROR_BASM_NoErrorWarningList
END
OTHERWISE Say "Internal error: Invalid warning state!"
END
OTHERWISE Say "Internal error: Invalid error state!"
END
ErrorState = RexxGetEnv( 'BAsmError.ced' )
WarningState = RexxGetEnv( 'BAsmWarning.ced' )
IF ((ErrorState = 'step')|(WarningState = 'step')) THEN
DO
ADDRESS VALUE Port_BAsm
IF (ErrorState='step') THEN
'BGETERROR'
ELSE
'BGETWARNING'
IF ((RC = BAsmError_OK)&(RESULT ~= '')) THEN
DO
PARSE VAR RESULT FailureLine '|' FailureOffset '|' FailureFile '|' FailureType ' ' FailureNumber ': ' FailureString '.'
ADDRESS VALUE Port_CygnusEd
'JUMP TO FILE '||FailureFile
IF (RESULT = 0) THEN /* file with error not in any view */
DO
'STATUS 66' /* total # of open views */
IF (RESULT >= MaxViews) THEN
DO
'OKAY1 '||FailureType||' #'||FailureNumber||' in line '||FailureLine||' of '||FaileFile||': '||FailureString||'.'
END
ELSE
DO
'OPEN NEW' /* make new view */
'OPEN "'||FailureFile||'"' /* load file with error into new view */
'JUMP TO BYTE '||FailureOffset
'OKAY1 '||FailureType||' #'||FailureNumber||' in line '||FailureLine||': '||FailureString||'.'
END
END
ELSE
DO
'JUMP TO BYTE '||FailureOffset
'OKAY1 '||FailureType||' #'||FailureNumber||' in line '||FailureLine||': '||FailureString||'.'
END
END
END
END
OPTIONS FAILAT ScriptErrorLevel
/*=============================================================================*/
END /* IF ~ SHOW('P', Port_CygnusEd) */
EXIT
SYNTAX:
SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
ADDRESS VALUE Port_CygnusEd
'OKAY1 Script error!'
EXIT
RexxSetEnv: PROCEDURE
PARSE ARG Name,Content
ADDRESS COMMAND 'SetEnv "ENV:'||Name||'" "'||Content||'"'
RETURN
RexxGetEnv: PROCEDURE
PARSE ARG Name
IF OPEN(EnvFile,'ENV:'||Name,'r') THEN
DO
Content = READLN(EnvFile)
CALL CLOSE EnvFile
END
ELSE Content = ""
RETURN Content
/*=============================================================================*/
/*
** version history:
** ---------------
**
** V1.0 : -first public version
**
** known bugs in the latest version/revision:
** -----------------------------------------
** - No localization supported. I don't know the ARexx CygnusEd command to find out the currect used language.
**
*/